package com.mar.framecompress.util;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

public class BufferInputStream extends InputStream {

	private final ByteBuffer underLyingBuff;
	
	public BufferInputStream( ByteBuffer buf ) {
		this.underLyingBuff = buf;
	}
	
	@Override
	public int read() throws IOException {
		if ( !underLyingBuff.hasRemaining() )
			return -1;
		return underLyingBuff.get();
	}

}
